# coding=utf-8
import re

autohome_rule = {
    "page" : r"https://car.autohome.com.cn/diandongche/list-0-0-0-0-0-0-0-0-\d+.html",
    "line" : r"https://car.autohome.com.cn/diandongche/series-\d+.html",
    "type" : r"https://www.autohome.com.cn/spec/\d+/",
}

def page_process_value(value):
    return process_value(autohome_rule["page"], value)

def line_process_value(value):
    return process_value(autohome_rule["line"], value)

def type_process_value(value):
    return process_value(autohome_rule["type"], value)

def process_value(regex ,value) :
    pattern = re.compile(regex)
    m = pattern.match(value)
    if m:
        return m.group()

